{% extends "orgs/base.html" %}

{% load i18n %}
{% load org_tags %}
{% load comments_tag %}

{% block head_title %}{{ task.summary }}{% endblock %}

{% block body %}
    <p><a href="{% url org_tasks task.org.slug %}">&larr; {% trans "Back to Task List for " %} {{ task.org }}</a></p>
    
    {% show_task task %}
    

    {% ifequal task.get_state_display 'open' %}
        {% if is_member %}
            <form action="" method="POST">
                <input type="hidden" name="action" value="mark_resolved" />
                <input type="submit" value="{% trans 'Mark Resolved' %}" />
            </form>
        {% endif %}
    {% else %}
        {% ifequal task.get_state_display 'resolved' %}
            {% ifequal request.user task.creator %}
                <form action="" method="POST">
                    <input type="hidden" name="action" value="mark_closed" />
                    <input type="submit" value="{% trans 'Mark Closed' %}" />
                </form>
            {% endifequal %}
            {% if is_member %}
                <form action="" method="POST">
                    <input type="hidden" name="action" value="reopen" />
                    <input type="submit" value="{% trans 'Reopen' %}" />
                </form>
            {% endif %}
        {% else %}
            {% if is_member %}
                <form action="" method="POST">
                    <input type="hidden" name="action" value="reopen" />
                    <input type="submit" value="{% trans 'Reopen' %}" />
                </form>
            {% endif %}
        {% endifequal %}
    {% endifequal %}
    
    <h2>Discussion</h2>
    {% comments task %}
{% endblock %}